import React, { ReactElement } from 'react'
import styled from 'styled-components';
// src round 回调事件
interface Props {
  src?: string,
  round?: boolean,
  imgClick?: () => void
}
const ImageWrapper = styled.div`
  width: 100%;
  height: 100%;
  img {
    width: 100%;
    height: 100%;
    border-radius: ${(props: Props) => props.round ? '50%' : ''}
  }
`
// props  事件
function ImageView(props: Props): ReactElement {
  const { src, round, imgClick } = props;
  return (
    <ImageWrapper round={round} onClick={imgClick}>
      <img src={src} alt='' />
    </ImageWrapper>
  )
}

export default ImageView;

